package com.example.yuejian.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;

import com.example.yuejian.R;
import com.example.yuejian.fragment.UnsendFragment;


public class Order extends AppCompatActivity implements View.OnClickListener{
    private Fragment mTab01;
    private ImageView back;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order);
        initView();
        selectEvents();
        setSelect(0);

    }

    private void initView(){
        back = (ImageView)findViewById(R.id.back);


    }
    private void selectEvents(){
        back.setOnClickListener(this);
    }
    private void setSelect(int i)
    {
        FragmentManager fm = Order.this.getSupportFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();


        switch (i) {

            case 0:
                if (mTab01 == null) {
                    mTab01 = new UnsendFragment();
                    transaction.add(R.id.id_content, mTab01);
                } else {
                    transaction.show(mTab01);
                }

                break;


        }
        transaction.commit();
    }





    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.back:
                onBackPressed();
                break;
            default:
                break;
        }

    }
}
